<template>
  <div>
<h1>我的订单</h1>
    <!--表格-->
    <el-table :data="iPage.records" border style="width: 100%">
      <el-table-column prop="id" label="订单号" width="180"/>
      <el-table-column prop="total" label="订单总价"/>
      <el-table-column prop="status" label="订单状态"/>
      <el-table-column prop="date" label="下单时间"/>

      <el-table-column label="操作">
        <template #default="scope">
          <el-button size="small" @click="$router.push({name:'/shopping/orderDetail',query:{id:scope.row.id}})">订单详情</el-button>
        </template>
      </el-table-column>
    </el-table>


<el-row>
  <!--分页-->
  <el-pagination
      v-model:currentPage="iPage.current"
      v-model:page-size="iPage.size"
      background
      layout="prev, pager, next, jumper"
      :total="iPage.total"
      @current-change="pageClick"
  />
</el-row>


    <el-row>
      <el-button type="info" @click="$router.push('/index')">返回首页</el-button>
    </el-row>

  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      iPage:{}
    }
  }, methods: {
    showOrder(pageNO){
      axios.get("/project/order/cutByItemInUser",{params:{pageNO}}).then(resp=>{
        this.iPage=resp.data;
      })
    },pageClick(pageNO) {
      this.showOrder(pageNO);
    }
  },created(){
    this.showOrder(1);
  }
}
</script>

<style scoped>
.el-row{
  margin: 20px;
}
</style>